home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
os2
/
timidsrc.zip
/
COMPILE.OS2
< prev
next >
Wrap
Text File
|
1997-06-03
|
5KB
|
84 lines
Notes for people who what to recompile or modify TiMidity for
OS/2. Must users will probably not be interrested in these details.
In set this up, just extract this file into the directory where
your OS/2 version of TiMidity is. It includes everything in the
primary distribution of TiMidity so you can use it to compile any
version.
To compile this you can either use the multimedia header files
from the OS/2 developer's toolkit or use mm4emx version 1.1. I've
added the DART constants and structures to the original mm4emx 1.0 to
create version 1.1. Remember to include the multimedia header files
from the developer's toolkit you must define INCL_MCIOS2, but for
mm4emx you must define INCL_OS2MM.
The first time you run make it will make the depends file. This
will eventually fail and end in an error. However, now that a depends
files when you run make again it will proceed to compile TiMidity. By
commenting or uncommenting the OS/2-PM interface section you can
choose if you compile the text or PM interface. They both will output
into the file timidity.exe or you'd best make a copy before you
compile the other type.
To compile the SLang interface you'll need the port for OS/2.
It's at the slrn for OS/2 homepage at
http://www.bgnett.no/~bjoff/slrn.html Hints to compile this: mkMake
is a DOS program so start up a DOS prompt to use it (you can't really
re-compile it, because it needs SLang). Move the makefile generated
in to the slang\src directly and make it. Move the slang.a file into
your \emx\lib directory and the slang.h and slcurses.h in your
\emx\include directory.
The .rc has been generated with the University Resource Editor.
You don't need to the URE to edited the .rc file. It can be done by
hand. If you did to use the URE you'll need to make a few changes to
the .rc file it generates. You need to remove the directory referance
from the icon resource (You have to do this every time, or the rc
compiler won't compile), add FCF_TASKLIST to the end of MAINWIN's
flag list and remove SLS_BUTTONSRIGHT from the POSSLIDER flags. The
files timigood.rc has all the changes done (as does the timidity.rc in
the distrabution).
In the PM interface there are several places where it converts
lenghts of time from one unit to another. These units are often very
precise (As in 1/50000th of a second) and while they fit into 32 bit
numbers by themselves converting them from one format to another
involves multiplying and dividing by some large constants. That
creates, temporarily, a very large number. One that can't fit into 32
bits. CPUs are designed take then into account by allowing the
results of multiplications and dividends to stretch across 2 words (64
bits in two registers). However, compilers don't allow you to do then
because it might produce unexpected results.
Overcoming this involves a bit of assembler. The gnu compiler
comes with an assembler, because one uses it itself, so you don't need
any more software. What I did is create the small file muldivor.c
which just contains a function to multiply two numbers and then divide
that my a third. I took that file and compiler it to assembler with
the command gcc -S -O2 muldivor.c. This generates the assembler file
muldivor.s. You can take a look at it. It's not that hard to fallow
if you know even a little about assembly. You can see that it does
the imull instruction, clears the edx register by xoring it with
itself, and then does the division. The edx register is where the
upper 32 bits of the multiplication is stored. All you have to do is
remove the xor instuction. The imull instruction is actually a signed
multiplication, which is not what we are really doing, so you can
change that instruction to mull. If you do that you also must remove
the %eax from them end because with the mull instruction you can't
give the destination register. The destination is always eax:edx.
Basically the instruction becomes "mull 12(%ebp)". The file divmul.s
contains all these changes. Make will just assemble it into an object
file it for you when you compile TiMidity.
The TiMidity, being cross platform, was designed so you could
fairly easily add new interfaces to it. Once I created the PM
interface to interface with TiMidity I found things could work both
ways. It was not fairly easy to add new players to the PM interface.
How it works in the function play checks if a file is a MIDI file or
not. If it is it runs play_midi_file, the TiMidity function to plays
the file with TiMidity. As TiMidity cycles it runs ctl_read which
checks the message queue and reacts appropriately. It it's not a MIDI
file it will run the function playmmos2file which plays the MMOS/2
file and handles messages.